package geez.widget;

import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.Widget;

public class GDialogBox extends DialogBox {

    public GDialogBox id(String id) {
        Geez.withNameAndId(this, id);
        return this;
    }

    public GDialogBox css(String cssClass, String... optionalClasses) {
// NB - When using Caption - must create a "Caption" style class due to impl of DialogBox Widget
        Geez.withStyle(this, cssClass, optionalClasses);
        return this;
    }

    public GDialogBox show(boolean v) {
        if (v) {
            super.show();
        } else {
            super.hide();
        }
        return this;
    }

    public GDialogBox title(String title) {
        this.setTitle(title);
        return this;
    }

    public GDialogBox text(String text) {
        this.setText(text);
        return this;
    }

    public GDialogBox initialPosition(int x, int y) {
        this.setPopupPosition(x, y);
        return this;
    }

    public GDialogBox withWidget(Widget widget) {
        this.setWidget(widget);
        return this;
    }
}
